<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #render-dom {
            width: 794px;

        }

        table {
            /* height: 1123px; */
            margin: 0 auto;
            border: 1px solid #000000;
            border-collapse: collapse;
        }

        td {
            border: 1px solid #000000;
            text-align: center;
            padding: 10px;
        }

        td:nth-of-type(1) {
            width: 40px;
        }
    </style>
</head>

<body>
    <!-- <table>
        <tr>
            <td>拍照时间</td>
            <td>2025年05月27日14时57分</td>
            <td>地点</td>
            <td>荣乌高速天津方向K897+012</td>
        </tr>
        <tr>
            <td>方向</td>
            <td>天津方向</td>
            <td>拍照人</td>
            <td>张三</td>
        </tr>
        <tr>
            <td class="text-col">
                <span style="width: 1em;display: inline-block;">照片1</span>
            </td>
            <td colspan="3">
                <img id="img_1" width="500px" height="300px"
                    src="http://27.128.235.82:88/serverdata/xxhgl/20250527/6333645868680192.jpg">
            </td>
        </tr>
        <tr>
            <td>拍照时间</td>
            <td>2025年05月27日14时57分</td>
            <td>地点</td>
            <td>荣乌高速天津方向K897+012</td>
        </tr>
        <tr>
            <td>方向</td>
            <td>天津方向</td>
            <td>拍照人</td>
            <td>张三</td>
        </tr>
        <tr>
            <td class="text-col">
                <span style="width: 1em;display: inline-block;">照片1</span>
            </td>
            <td colspan="3">
                <img id="img_1" width="500px" height="300px"
                    src="http://27.128.235.82:88/serverdata/xxhgl/20250527/6333645868680192.jpg">
            </td>
        </tr>
        <tr>
            <td class="text-col">备注</td>
            <td colspan="3"> </td>
        </tr>
    </table> -->
</body>

</html>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
    function getCanvasBase64(img) {
        var image = new Image();
        //至关重要
        image.crossOrigin = '*';
        image.src = img;
        //至关重要
        var deferred = $.Deferred();
        if (img) {
            image.onload = function () {
                deferred.resolve(getBase64Image(image));//将base64传给done上传处理
                //document.getElementById("container2").appendChild(image);
            }
            return deferred.promise();//问题要让onload完成后再return sessionStorage['imgTest']
        }
    }

    getCanvasBase64('http://47.92.235.205/lpjpg/2025/08/12/1955207224750641153.png')
        .then(function (base64) {
            // 这里拿到的是转换后的base64地址，可以做其他操作
            console.log("方式二》》》》》》》》》", base64);
            this.webImageBase = base64

        }, function (err) {
            console.log(err);
        });
</script>